<template>
  <view class="car-index-bg">
    <!-- 顶部栏 -->
    <view class="car-index-header">
      <uni-icons type="left" size="30" style="color: white;margin-right: 20px"></uni-icons>
      <view class="header-title">洗车</view>
    </view>
    <!-- 店铺大图 -->
    <image src="/static/yyq/carwash_banner.jpg" class="shop-banner" mode="aspectFill" />
    <!-- 店铺信息 -->
    <view class="shop-info-card">
      <view class="shop-title">车百事汽车生活馆</view>
      <view class="shop-meta">
        <text class="star">★</text>
        <text class="score">4.9</text>
        <text class="meta-split">|</text>
        <text class="meta-label">销量：</text>
        <text class="meta-value">556</text>
      </view>
      <view class="shop-time">营业时间：周一-至周五 8:00-22:00</view>
      <view class="shop-addr">地址：山阳区人民路和政和路交叉口</view>
    </view>
    <!-- 服务项目 -->
    <view class="service-card">
      <view class="service-title">服务项目</view>
      <view class="service-tags">
        <view v-for="(item, index) in serviceTags" :key="index" class="service-tag" :class="{active: index === 1}">{{ item }}</view>
      </view>
      <view class="service-price-row">
        <text class="service-price">￥35.9</text>
        <text class="service-old-price">￥60</text>
      </view>
      <view class="service-desc">这里是精选服务的详细介绍，这里是精选服务的详细介绍，这里是精选服务的详细介绍</view>
    </view>
    <!-- 服务评价 -->
    <view class="comment-card">
      <view class="comment-title">服务评价</view>
      <view class="comment-list">
        <view class="comment-item" v-for="(item, idx) in commentList" :key="idx">
          <image :src="item.avatar" class="comment-avatar" />
          <view class="comment-main">
            <view class="comment-header">
              <text class="comment-nick">{{ item.nick }}</text>
              <text class="comment-star">{{ item.star }}</text>
              <text class="comment-date">{{ item.date }}</text>
            </view>
            <view class="comment-content">{{ item.content }}</view>
          </view>
        </view>
      </view>
    </view>
  </view>
  <!-- 底部按钮 -->
  <view class="button">
    <view class="button-item" style="margin-left: 20px" @click="showPopup = true">
      <uni-icons type="staff-filled" size="30"></uni-icons>
      <text class="button-primary">联系客服</text>
    </view>
    <view class="button-item" style="margin-right: 20px">
      <button type="primary" class="item-butt">立即下单</button>
    </view>
  </view>

  <!-- 弹窗内容 -->
  <view v-if="showPopup" class="popup-mask" @click.self="showPopup = false">
    <view class="popup-content">
      <view class="popup-phone">18642589456</view>
      <button class="popup-btn" @click="copyPhone">复制</button>
      <button class="popup-btn cancel" @click="showPopup = false">取消拨号</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
const serviceTags = ref(['普通洗车', '精洗', '内饰清洗', '其他清洗']);
const commentList = ref([
  {
    avatar: '/static/yyq/avatar1.jpg',
    nick: '黄**',
    star: '⭐⭐⭐⭐⭐',
    date: '2022-12-31',
    content: '洗的非常干净，几个小伙子很用心，态度也很好，赞赞赞~强烈安利这家店！！！',
  },
  {
    avatar: '/static/yyq/avatar2.jpg',
    nick: '黄**',
    star: '⭐⭐⭐⭐⭐',
    date: '2022-12-31',
    content: '洗的非常干净，几个小伙子很用心，态度也很好，赞赞赞~强烈安利这家店！！！',
  },
]);
const showPopup = ref(false);

function copyPhone() {
  uni.setClipboardData({
    data: '18642589456',
    success: () => {
      uni.showToast({ title: '已复制', icon: 'success' });
    }
  });
}
</script>

<style scoped lang="scss">
.button-item{
  display: flex;
  align-items: center;
}
.item-butt{
  font-size: 12px;
  width: 120px;
  border-radius: 50px;
}
.button{
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  width: 100%;
  background-color: white;
}
.car-index-bg {
  min-height: 100vh;
  background: linear-gradient(180deg, #338aff 0%, #338aff 120px, #f5f6fa 120px, #f5f6fa 100%);
  padding-bottom: 24px;
}
.car-index-header {
  display: flex;
  align-items: center;
  height: 56px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  position: relative;
  padding: 0 16px;
}
.icon-back {
  font-size: 22px;
  color: #fff;
  margin-right: 8px;
}
.header-title {
  position: absolute;
  left: 165px;
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
}
.header-icons {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}
.iconfont {
  font-size: 22px;
  color: #fff;
  margin-left: 12px;
}
.shop-banner {
  width: 92vw;
  height: 160px;
  object-fit: cover;
  border-radius: 16px;
  margin: 12px 4vw 0 4vw;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.shop-info-card {
  background: #fff;
  border-radius: 16px;
  margin: 16px 16px 0 16px;
  padding: 16px 20px 12px 20px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.shop-title {
  font-size: 18px;
  font-weight: bold;
  color: #222;
  margin-bottom: 4px;
}
.shop-meta {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #888;
  margin: 4px 0;
}
.star {
  color: #ff9800;
  margin-right: 2px;
}
.score {
  color: #ff9800;
  margin-right: 6px;
}
.meta-split {
  margin: 0 6px;
}
.meta-label {
  color: #888;
}
.meta-value {
  color: #338aff;
}
.shop-time {
  font-size: 13px;
  color: #888;
  margin-bottom: 2px;
}
.shop-addr {
  font-size: 13px;
  color: #888;
}
.service-card {
  background: #fff;
  border-radius: 16px;
  margin: 16px 16px 0 16px;
  padding: 16px 20px 12px 20px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.service-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}
.service-tags {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.service-tag {
  background: #f5f6fa;
  border-radius: 12px;
  color: #338aff;
  padding: 4px 14px;
  margin-right: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.service-tag.active {
  background: #338aff;
  color: #fff;
}
.service-price-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
}
.service-price {
  color: #ff4d4f;
  font-size: 20px;
  font-weight: bold;
  margin-right: 8px;
}
.service-old-price {
  color: #bbb;
  font-size: 14px;
  text-decoration: line-through;
}
.service-desc {
  color: #888;
  font-size: 13px;
  margin-top: 4px;
}
.comment-card {
  background: #fff;
  border-radius: 16px;
  margin: 16px 16px 0 16px;
  padding: 16px 20px 12px 20px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
}
.comment-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}
.comment-list {
  margin-top: 4px;
}
.comment-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
}
.comment-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin-right: 12px;
}
.comment-main {
  flex: 1;
}
.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}
.comment-nick {
  font-weight: bold;
  margin-right: 8px;
  color: #333;
}
.comment-star {
  color: #ff9800;
  margin-right: 8px;
}
.comment-date {
  color: #bbb;
  font-size: 13px;
}
.comment-content {
  color: #444;
  font-size: 14px;
  line-height: 1.6;
}
.popup-mask {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: flex-end;
  z-index: 999;
}
.popup-content {
  width: 100%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 24px 0 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.popup-phone {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
}
.popup-btn {
  width: 80%;
  margin: 8px 0;
  padding: 12px 0;
  border-radius: 8px;
  background: #338aff;
  color: #fff;
  font-size: 16px;
  border: none;
}
.popup-btn.cancel {
  background: #eee;
  color: #333;
}
</style>
